package org.dftproject.genesis.ui.figures;

import java.util.LinkedList;
import java.util.List;

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Dimension;

public class UniformSizeGroup {
	
	private final List<IFigure> figures = new LinkedList<IFigure>();
	
	public void add(IFigure figure) {
		figures.add(figure);
	}
	
	public Dimension getMinimumSize(int wHint, int hHint) {
		Dimension size = new Dimension();
		
		for (IFigure figure : figures)
			size.union(figure.getMinimumSize(wHint, hHint));
		
		return size;
	}
	
	public Dimension getPreferredSize(int wHint, int hHint) {
		Dimension size = new Dimension();
		
		for (IFigure figure : figures)
			size.union(figure.getPreferredSize(wHint, hHint));
		
		return size;
	}

}
